package com.yuyou.fn.common.lang;


import java.util.Objects;

public class Tuple3<T1,T2,T3> extends Tuple {

    private T1 first ;

    private T2 second ;

    private T3 three ;

    public Tuple3(T1 first, T2 second ,T3 three) {
        this.first = first;
        this.second = second;
        this.three = three ;
    }

    public T1 getFirst() {
        return first;
    }

    public void setFirst(T1 first) {
        this.first = first;
    }

    public T2 getSecond() {
        return second;
    }

    public void setSecond(T2 second) {
        this.second = second;
    }

    public T3 getThree() {
        return three;
    }

    public void setThree(T3 three) {
        this.three = three;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tuple3<?, ?, ?> tuple3 = (Tuple3<?, ?, ?>) o;
        return Objects.equals(first, tuple3.first) &&
                Objects.equals(second, tuple3.second) &&
                Objects.equals(three, tuple3.three);
    }

    @Override
    public int hashCode() {
        return Objects.hash(first, second, three);
    }

    @Override
    public String toString() {
        return "Tuple3{" +
                "first=" + first +
                ", second=" + second +
                ", three=" + three +
                "} " + super.toString();
    }

    public static <T1,T2,T3> Tuple3<T1,T2,T3> of(T1 first, T2 second , T3 three){
        return new Tuple3<>(first,second,three);
    }
}
